package com.team.service.impl;

import com.team.dao.NewsMapper;
import com.team.entity.News;
import com.team.service.ApprovalNewsService;
import com.team.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author keluoyisi
 * @program: seven
 * @description: 新闻审批实现类
 * @date 2022-10-18 19:12:04
 */
@Service
public class ApprovalNewsServiceImpl implements ApprovalNewsService {
    @Autowired
    private NewsMapper newsMapper;

    /**
     * @param id:
     * @return Result
     * @description 审核通过修改status
     */
    @Override
    public Result agree(int id) {
        newsMapper.updateStatus(id,1);
        return new Result(200,"完成");
    }

    /**
     * @param news:
     * @return Result
     * @description 审核拒绝修改理由
     */
    @Override
    public Result refuse(News news) {
        news.setStatus(3);
        newsMapper.updateReason(news);
        return new Result(200,"完成");
    }
}
